package org.airline.entity;



import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.airline.utils.DateUtil;

@Entity
public class FlightArrange {

	private int id;
	private String startDate = DateUtil.parseToString(new Date()); // 起飞时间
	private Flight flight; // 航班对象
	private String ticketsNum; // 出售票数
	private List<OrderItem> orderItemList;
	
	@ManyToOne
	@JoinColumn(name = "flightID")
	public Flight getFlight() {
		return flight;
	}
	
	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}
	

	public void setFlight(Flight flight) {
		this.flight = flight;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	public String getTicketsNum() {
		return ticketsNum;
	}

	public void setTicketsNum(String ticketsNum) {
		this.ticketsNum = ticketsNum;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	@OneToMany(mappedBy = "flightArrange", cascade = CascadeType.ALL)
	public List<OrderItem> getOrderItemList() {
		return orderItemList;
	}

	public void setOrderItemList(List<OrderItem> orderItemList) {
		this.orderItemList = orderItemList;
	}
	
	
}
